package com.google.code.swingonfire.component.page;

import java.awt.Component;

/**
 * Model for JPagedPane. Holds components, which are identified by their index. It is not necessary, that the components
 * are initialized early.
 * 
 * @author thred
 */
public interface JPagedPaneModel
{

    /**
     * Returns the component at the specified index. The component must not be initialized, nor be an added member of
     * the {@link JPagedPane}.
     * 
     * @param index the index
     * @return the component
     */
    Component getComponent(int index);

    /**
     * Called by the {@link JPagedPane} to indicate, that the component is currently no longer used
     * 
     * @param index the index
     * @param component the component
     */
    void invalidateComponent(int index, Component component);

    /**
     * The lowest possible (valid) index, return Integer.MIN_VALUE to suggest infinity
     * 
     * @return the lowest possible indedx
     */
    int getMinimumComponentIndex();

    /**
     * The highest possible (valid) index, return Integer.MAX_VALUE to suggest infinity
     * 
     * @return the highest possible index
     */
    int getMaximumComponentIndex();

}
